import React, { PureComponent } from "react"
import Styles from '@/scss/froms.scss'
//引入子组件
import UpdateNav from '@/pages/components/rights/from/from_nav/updatenav'
import CreateNav from '@/pages/components/rights/from/from_nav/createnav'
/***************   此处可替换为直接注入mobx,代码结构将更清晰  ******************* */
//表单提交导航栏
class FromNav extends PureComponent<Iprops, any>{
    //判断是更新表单还是创建表单,以此进行不同操作
  render() {
    return (
      <div className={Styles.from_nav}>
        { this.props.start ?
          <UpdateNav
            handleMoveRecyle={this.props.handleMoveRecyle}
            changeVisible={this.props.changeVisible}
             hadleSubmit={this.props.hadleSubmit}
             handleCollect={this.props.handleCollect}
            todo={this.props.todo}
            getCollectByID={this.props.getCollectByID}
          /> :
          <CreateNav changeVisible={this.props.changeVisible} />
        }
      </div>
    )
  }
}
//传入的
type Iprops = {
  todo: any,
  start: string
  hadleSubmit: () => void,
  changeVisible: () => void,
  handleMoveRecyle: (id: string, state: string) => void
  handleCollect: (id: string, state: string) => void
  getCollectByID: (id: string) => boolean
}

export default FromNav